Skip to content

Views: Removed strongly typed View Settings#2066

Closed
filipvnencak wants to merge 3 commits into
developfrom
Removed-strongly-typed-View-Settings
Closed

Views: Removed strongly typed View Settings#2066
filipvnencak wants to merge 3 commits into
developfrom
Removed-strongly-typed-View-Settings

Conversation

@filipvnencak

@filipvnencak filipvnencak commented Jun 16, 2026

Copy link
Copy Markdown
Collaborator

Description of changes

Frontend now owns its view settings types instead of generating them from the REST schema, so adding a view setting no longer needs a backend change. Pairs with backend #974.

Technical details

  • Settings types moved to shared/src/api/viewSettings.ts; all consumers repointed there.
  • views.ts regenerated against Removed strongly typed View Settings ayon-backend#974 -> GenericView*.
  • Codegen renamed the create/update body arg, so updateViews.ts pins a stable payload contract to keep saves working.

Additional context

Pairs with ynput/ayon-backend#974

@filipvnencak filipvnencak requested a review from Copilot June 16, 2026 06:34
@filipvnencak filipvnencak self-assigned this Jun 16, 2026
@filipvnencak filipvnencak added the type: enhancement Improvement of existing functionality or minor addition label Jun 16, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR decouples per-view settings typing from the generated REST schema by moving frontend-owned view settings types into a dedicated module, reducing coupling to backend schema/codegen changes and stabilizing the view save/create contract.

Changes:

  • Introduce shared/src/api/viewSettings.ts to own view settings and column type shapes on the frontend.
  • Repoint view-settings consumers across pages/shared utilities to import settings types from @shared/api/viewSettings.
  • Adapt to regenerated views API types (GenericView*) and add RTK Query endpoint overrides to preserve a stable payload mutation argument for create/update.

Reviewed changes

Copilot reviewed 18 out of 19 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/pages/VersionsProductsPage/context/VPViewsContext.tsx Switch Versions view settings type import to frontend-owned settings types.
src/pages/ProjectsPage/hooks/useProjectSorting.ts Repoint OverviewSettings typing to @shared/api/viewSettings.
src/pages/ProjectsPage/hooks/useProjectGrouping.ts Repoint OverviewSettings typing to @shared/api/viewSettings.
src/pages/ProjectsPage/hooks/useProjectFilters.ts Repoint OverviewSettings typing to @shared/api/viewSettings.
src/pages/ProjectsPage/hooks/useProjectColumnConfig.ts Repoint OverviewSettings typing to @shared/api/viewSettings.
src/pages/ProjectOverviewPage/context/ProjectOverviewContext.tsx Repoint OverviewSettings import to @shared/api/viewSettings.
src/pages/ProjectListsPage/context/ReviewCardsSettingsContext.tsx Repoint ReviewsSettings import to @shared/api/viewSettings.
src/pages/ProjectListsPage/components/TableGridPlaylistSwitch/TableGridPlaylistSwitch.tsx Repoint ReviewsSettings import to @shared/api/viewSettings.
src/pages/ProjectListsPage/components/ProjectListsDetailsPanels/ProjectListsDetailsPanels.tsx Repoint ReviewsSettings import to @shared/api/viewSettings.
shared/src/util/columnConfigConverter.ts Use frontend-owned OverviewSettings / ColumnItemModel types.
shared/src/containers/Views/utils/generateWorkingView.ts Use GenericViewPostModel for working view payload generation.
shared/src/containers/Views/hooks/useViewsMutations.ts Update mutation payload typing to use GenericViewPostModel.
shared/src/containers/Views/hooks/pages/useTaskProgressViewSettings.ts Repoint view settings types to @shared/api/viewSettings.
shared/src/containers/Views/hooks/pages/useOverviewViewSettings.ts Repoint view settings types to @shared/api/viewSettings.
shared/src/containers/Views/hooks/pages/useListsViewSettings.ts Repoint view settings types to @shared/api/viewSettings.
shared/src/containers/Views/context/ViewsContext.tsx Re-export ViewSettings from the new frontend-owned types module.
shared/src/api/viewSettings.ts New: frontend-owned view settings / columns types.
shared/src/api/queries/views/updateViews.ts Override RTK Query create/update mutations to keep FE mutation arg stable as payload.
shared/src/api/generated/views.ts Regenerated views API types (GenericView*) and request body arg renaming (genericViewPostModel / genericViewPatchModel).

Comment thread shared/src/api/queries/views/updateViews.ts Outdated
Comment thread shared/src/api/queries/views/updateViews.ts Outdated
filipvnencak and others added 2 commits June 16, 2026 08:40
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@filipvnencak filipvnencak changed the title Views: decouple settings types Views: Removed strongly typed View Settings Jun 16, 2026
@filipvnencak filipvnencak requested a review from kalisp June 16, 2026 08:34

@kalisp kalisp left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ran this with BE PR, switched between stored Views, re-saved some of them.

Didn't explode.

@filipvnencak filipvnencak marked this pull request as ready for review June 16, 2026 13:22
@filipvnencak filipvnencak requested a review from Innders June 16, 2026 13:22
// Codegen names the request body arg after its model (genericViewPostModel).
// Override the query so the whole FE keeps passing `payload`, regardless of
// how codegen names the arg on the next regen.
query: ({ viewType, projectName, payload }: CreateViewArg) => ({

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not a fan of overriding the original query just so that it can use payload argument.

Can we please remove this and update the args to use genericViewPatchModel and convert all queries to use it.

OR get backend to change the arg name to something nicer (preferred).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: enhancement Improvement of existing functionality or minor addition

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants